"""
总API，所有app的api都由这里导入和注册
"""
from ninja_extra import NinjaExtraAPI

from areas.api import AreaController
from carts.views import CartsAPI, CartSelectionAPI
from goods.views import SKUController
from oauth.controller import QQAuthController
from orders.views import CountOrderAPI
from users.api import UserInfoController, ValidateUserInfo, UserCenter, AddressAPI, UserBrowseHistory
from verifications.api import UserTokenController

# ########### CBV方式视图 ###################
api = NinjaExtraAPI(
    title="美多商城--Django-Ninja",
    description="使用DjangoNinjaExtra实现的美多商城后端管理接口",
    version="1.0.0",
    urls_namespace="MeiDuo-ninja",
)

api.register_controllers(
    UserTokenController,
    UserInfoController,
    ValidateUserInfo,
    UserCenter,
    QQAuthController,
    AreaController,
    AddressAPI,
    SKUController,
    UserBrowseHistory,
    CartsAPI,
    CartSelectionAPI,
    CountOrderAPI,
)

# ##########  FBV方式视图 ###################
from .apps.verifications.api import api as sms

api.add_router('/users/', 'users.api.api')
# api.add_router('/users/', user)
api.add_router('/sms/', sms)
